<template>

  <div style="margin:40px;">
    <el-card class="box-card">
      <div slot="header" class="clearfix" style="position: relative;">
        <span style="margin:0;font-size:18px;font-weight:bold;">{{ this.$route.meta.title }}</span>
        <el-button style=" padding:3px 0;position:absolute;right:0;top:10px; " type="text" @click="cancelForm">返回列表
        </el-button>
      </div>

      <div style="max-width:100%;margin:auto;">
        <table class="table table-bordered th-bg">
          <thead>
          <tr>
            <th colspan="4">外资企业详情
            </th>
          </tr>
          </thead>
          <tbody>
          <tr>
            <th width="15%">注册码/统一社会信用代码</th>
            <td width="35%">
              {{ form.creditCode }}
            </td>
            <th width="15%">企业名称</th>
            <td width="35%">
              {{ form.enterpriseName }}
            </td>
          </tr>
          <tr>
            <th width="15%">法定代表人/责任人</th>
            <td width="35%">
              {{ form.legalPerson }}
            </td>
            <th width="15%">住所</th>
            <td width="35%">
              {{ form.residence }}
            </td>
          </tr>
          <tr>
            <th width="15%">注册资本</th>
            <td width="35%">
              {{ form.registeredCapital }}
            </td>
            <th width="15%">备注</th>
            <td width="35%">
              {{ form.notes }}
            </td>
          </tr>
          </tbody>
        </table>
      </div>
    </el-card>

  </div>
</template>

<script>
import crudForeign from '@/api/business/enterprise/foreign'

export default {
  components: {
  },
  props: {},
  data() {
    return {
      id: '',
      form: {},
      
    }
  },

  created() {
    this.id = this.$route.params && this.$route.params.id;
    this.fetchData(this.id)
  },
  computed: {},
  methods: {
    fetchData(id) {
      const fetchMethod = crudForeign.get
      fetchMethod(id).then(response => {
        this.form = response.data;
        if (response.data && response.data.businessLicenseFileList) {
          for (let i = 0; i < response.data.businessLicenseFileList.length; i++) {
            const item = response.data.businessLicenseFileList[i]
            const file = {
              fileId: item.fileId,
              name: item.fileName,
              url: `business/file/download?fileId=${item.fileId}`
            }
            this.businessLicenseFileInfo.push(file)
          }
        }
        if (response.data && response.data.photoFileList) {
          for (let i = 0; i < response.data.photoFileList.length; i++) {
            const item = response.data.photoFileList[i]
            const file = {
              fileId: item.fileId,
              name: item.fileName,
              url: `business/file/download?fileId=${item.fileId}`
            }
            this.photoFileInfo.push(file)
          }
        }
        if (response.data && response.data.environmentFileList) {
          for (let i = 0; i < response.data.environmentFileList.length; i++) {
            const item = response.data.environmentFileList[i]
            const file = {
              fileId: item.fileId,
              name: item.fileName,
              url: `business/file/download?fileId=${item.fileId}`
            }
            this.environmentFileInfo.push(file)
          }
        }
        if (response.data && response.data.environmentReviewFileList) {
          for (let i = 0; i < response.data.environmentReviewFileList.length; i++) {
            const item = response.data.environmentReviewFileList[i]
            const file = {
              fileId: item.fileId,
              name: item.fileName,
              url: `business/file/download?fileId=${item.fileId}`
            }
            this.environmentReviewFileInfo.push(file)
          }
        }
        if (response.data && response.data.environmentAcceptFileList) {
          for (let i = 0; i < response.data.environmentAcceptFileList.length; i++) {
            const item = response.data.environmentAcceptFileList[i]
            const file = {
              fileId: item.fileId,
              name: item.fileName,
              url: `business/file/download?fileId=${item.fileId}`
            }
            this.environmentAcceptFileInfo.push(file)
          }
        }
        if (response.data && response.data.contractFileList) {
          for (let i = 0; i < response.data.contractFileList.length; i++) {
            const item = response.data.contractFileList[i]
            const file = {
              fileId: item.fileId,
              name: item.fileName,
              url: `business/file/download?fileId=${item.fileId}`
            }
            this.contractFileInfo.push(file)
          }
        }

        if (response.data && response.data.taxFileList) {
          for (let i = 0; i < response.data.taxFileList.length; i++) {
            const item = response.data.taxFileList[i]
            const file = {
              fileId: item.fileId,
              name: item.fileName,
              url: `business/file/download?fileId=${item.fileId}`
            }
            this.taxFileInfo.push(file)
          }
        }

        if (response.data && response.data.pollutionPermitFileList) {
          for (let i = 0; i < response.data.pollutionPermitFileList.length; i++) {
            const item = response.data.pollutionPermitFileList[i]
            const file = {
              fileId: item.fileId,
              name: item.fileName,
              url: `business/file/download?fileId=${item.fileId}`
            }
            this.pollutionPermitFileInfo.push(file)
          }
        }
      }).catch(err => {
        console.log(err)
      })
    },
    cancelForm() {
      this.$router.push('/business/enterprise/foreign')
    },

  },

}
</script>

<style rel="stylesheet/scss" lang="scss" scoped>
::v-deep .el-input-number .el-input__inner {
  text-align: left;
}

.amap-wrapper {
  width: 500px;
  height: 500px;
}

::v-deep .map-dialog .el-dialog__body {
  padding: 10px 20px;
}

::v-deep .el-card__header {
  border-bottom: none !important;
}
</style>
